<?php


namespace api\zmt\validate;


use think\Validate;

class AdminValidate extends Validate
{
    //定义验证规则
    protected $rule = [
        'name' => 'require|max:20',
        'mobile' => 'require|mobile',
        //'image' => 'require',
        'code' => 'require',
    ];
    //定义验证失败时的提示信息
    protected $message = [
        'name.requireIf' => '姓名不能为空',
        'name.max:20' => '姓名最多不能超过20个字符',
        'mobile.require' => '手机号不能为空',
        //'image.require' => '头像不能为空',
        'mobile.mobile' => '手机号格式错误',
        //'mobile.unique' => '手机号已注册',
        'id.require' => 'id不能为空',
        'code.require' => '验证码不能为空'
    ];

    //验证场景
    protected  $scene = [
        'register' => ['mobile','code'],
        'login' => ['mobile','code'],
    ];
}